<?php

namespace app\beautiful\model\mall;

use app\common\model\CommonModel;



class PinTuanGoodsModel extends CommonModel{

    protected  $name = 'beautiful_goods_pin_tuan';

    protected  $pk   = 'pin_tuan_goods_id';



    public function goods()

    {

        return $this->hasOne(GoodsModel::class,'goods_id','goods_id');

    }



    public function getPinTuanTimeAttr($value,$data)

    {

        return [$data['start_time'],$data['end_time']];

    }
    public function getPinTuanProgressAttr($value,$data)

    {

        return (round($data['fictitious_take_count']/($data['fictitious_take_count']+$data['quota']),2)*100)."%";

    }
}

